#include "anapencere.h"
#include "ui_anapencere.h"
#include "QProcess"
#include "QMessageBox"
#include "QLineEdit"

AnaPencere::AnaPencere(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::AnaPencere)
{
    ui->setupUi(this);
}

AnaPencere::~AnaPencere()
{
    delete ui;
}

void AnaPencere::on_commandLinkButton_clicked()
{
    if (ui->AramaComboBox->currentText() == "Altta")
    {
    QProcess::execute("gsettings set com.solus-project.brisk-menu search-position bottom");
    }
    else
    {
    QProcess::execute("gsettings set com.solus-project.brisk-menu search-position top");
    }

    if (ui->PencereComboBox->currentText() == "Klasik")
    {
    QProcess::execute("gsettings set com.solus-project.brisk-menu window-type 'classic'");
    }
    else
    {
    QProcess::execute("gsettings set com.solus-project.brisk-menu window-type 'dash'");
    }

    if (ui->TemaComboBox->currentText() == "Açık")
    {
    QProcess::execute("gsettings set com.solus-project.brisk-menu dark-theme false");
    }
    else
    {
    QProcess::execute("gsettings set com.solus-project.brisk-menu dark-theme true");
    }

    if (ui->FareComboBox->currentText() == "Evet")
    {
    QProcess::execute("gsettings set com.solus-project.brisk-menu rollover-activate true");
    }
    else
    {
    QProcess::execute("gsettings set com.solus-project.brisk-menu rollover-activate false");
    }

    if (ui->EtiketVarComboBox->currentText() == "Evet")
    {
    QProcess::execute("gsettings set com.solus-project.brisk-menu label-visible true");
    }
    else
    {
    QProcess::execute("gsettings set com.solus-project.brisk-menu label-visible false");
    }

    QString etiket = ui->lineEdit->text();
    QProcess::execute("gsettings set com.solus-project.brisk-menu label-text '"+etiket+"'");

    QString logoyol1 = ui->logoyol->text();

    ui->menulogo->setPixmap(QPixmap(logoyol1) );
    QProcess::execute("sudo cp -f "+logoyol1+" /usr/share/pixmaps/milis-logo.png");

    QProcess::execute("sudo sed -i s/^Icon=start-here/Icon=milis-logo/g /usr/share/mate-panel/applets/com.solus_project.brisk.BriskMenu.mate-panel-applet");
}

void AnaPencere::on_commandLinkButton_2_clicked()
{
    QProcess::execute("gsettings set com.solus-project.brisk-menu search-position 'bottom'");
    QProcess::execute("gsettings set com.solus-project.brisk-menu window-type 'classic'");
    QProcess::execute("gsettings set com.solus-project.brisk-menu dark-theme false");
    QProcess::execute("gsettings set com.solus-project.brisk-menu rollover-activate true");
    QProcess::execute("gsettings set com.solus-project.brisk-menu label-visible true");
    QProcess::execute("gsettings set com.solus-project.brisk-menu label-text 'Menu'");
}

void AnaPencere::on_commandLinkButton_3_clicked()
{
    QMessageBox::information(this, "Birmen","Brisk Menü Ayarlama Uygulaması \nCihan Alkan Tarafından Hazırlanmıştır.");
}
